<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="角色操作">
    <#if (role.id)??>
        <#assign isEdit = true />
    <#else>
        <#assign isAdd = true />
    </#if>
<body class="input">
<script type="text/javascript">
    function checkall() {
        $("input[type='checkbox']").attr("checked", "true");
    }
    function checkout() {
        $("input[type='checkbox']").each(function () {
            if ($(this).attr("checked")) {
                $(this).removeAttr("checked");
            } else {
                $(this).attr("checked", 'true');
            }
        });
    }
</script>
<div class="body">
    <form id="validateForm" class="validate" method="post" action="${web_base}/system/role_permission!update.htm">
        <#list ps as p>
                <#if p.level??&& p.level==1></br></br></#if>
            <#if p.level??&&p.level==2><br/>&nbsp;&nbsp;&nbsp;</#if>
            <input id="ch" type="checkbox" name="codes" value="${(p.code)!}"
                   <#if p.opt?default(false)==true >checked='checked'</#if>   >${(p.name)!}--${(p.level)!}
            </input>
        </#list>
        <br/><br/><br/>非菜单权限：
        <#list notPs as p>
                 <#if p_index%13==0><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</#if>
                <input id="ch" type="checkbox" name="codes" value="${(p.code)!}"
                       <#if p.opt?default(false)==true >checked='checked'</#if>   >${(p.name)!}
                </input>

        </#list>
        <input type="hidden" name="roleId" value="${(roleId)!}">
        </br></br>
        <input type="button" value="全选" onclick="checkall();"/>&nbsp;
        <input type="button" value="反选" onclick="checkout();"/><br/>
        <input type="submit" value="提交">
    </form>
</div>
</body>

</@edit>